package com.wicket.okrbff.biz.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.wicket.okrbff.biz.service.ExecuteProgressService;
import com.wicket.okrbff.biz.service.dto.req.*;
import com.wicket.okrbff.biz.service.dto.res.*;
import com.wicket.okrbff.common.ro.OkrResult;
import com.wicket.okrbff.common.ro.OkrResult;
import com.wicket.okrbff.common.util.CommonFunctionHelper;
import com.wicket.okrbff.common.util.RedisUtil;
import javax.annotation.Resource;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;
import com.wicket.okrapp.integration.FwAppExecuteProgressClient;
import com.wicket.okrapp.integration.dto.QueryStepExecuteProgressDetailRespDto;
import com.wicket.okrapp.integration.dto.QueryStepExecuteProgressDetailReqDto;
import com.wicket.okrbff.common.exception.Assert;
import com.wicket.okrapp.integration.dto.ResetExecuteProgressDisposeRespDto;
import com.wicket.okrapp.integration.dto.ResetExecuteProgressDisposeReqDto;
import com.wicket.okrapp.integration.dto.ResetExecuteProgressDisposeComRespDto;
import com.wicket.okrapp.integration.dto.ResetExecuteProgressDisposeComReqDto;
import com.wicket.okrcomponent.integration.FwCompInterfaceModeClient;
import com.wicket.okrcomponent.integration.dto.ImplementFileAddressAllPathComRespDto;
import com.wicket.okrcomponent.integration.dto.ImplementFileAddressAllPathComReqDto;

/**
 * @author ：
 * @date ：
 *
 *
 * @version 1.0
 */
@Service
public class ExecuteProgressServiceImpl implements ExecuteProgressService {

  @Resource
  private RedisUtil redisUtil;
@Resource
  FwAppExecuteProgressClient fwAppExecuteProgressClient;
@Resource
  FwCompInterfaceModeClient fwCompInterfaceModeClient;
/**
   * B3获取执行进度情况(公共)[6975]
   * gen by moon at 1/18/2024, 7:21:23 PM
   */
    @Trace(operationName = "B3获取执行进度情况(公共)")
    @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Override
  public BffObtainExecuteProgressComBorderRespDto obtainExecuteProgressComBorder(BffObtainExecuteProgressComBorderReqDto reqDto){
      
       
       QueryStepExecuteProgressDetailRespDto queryStepExecuteProgressDetailRespDto_1 =null;
//步骤0: D3查步骤执行进度情况 - queryStepExecuteProgressDetail
     QueryStepExecuteProgressDetailRespDto queryStepExecuteProgressDetailRespDto = null;
    QueryStepExecuteProgressDetailReqDto queryStepExecuteProgressDetailReqDto=new QueryStepExecuteProgressDetailReqDto();
  if(reqDto!=null){
      queryStepExecuteProgressDetailReqDto.setObjectId(reqDto.getObjectId());//SimpleFieldAssign//sourceId:987855_1
queryStepExecuteProgressDetailReqDto.setUseTypeCode(reqDto.getUseTypeCode());//SimpleFieldAssign//sourceId:987856_1
queryStepExecuteProgressDetailReqDto.setThemeContentId(reqDto.getThemeContentId());//SimpleFieldAssign//sourceId:987857_1
queryStepExecuteProgressDetailReqDto.setConfItemCode(reqDto.getConfItemCode());//SimpleFieldAssign//sourceId:1071147_1
queryStepExecuteProgressDetailReqDto.setCustomField(reqDto.getCustomField());//SimpleFieldAssign//sourceId:987861_1
    }
  
    /*D3查步骤执行进度情况[6966]   */
    Assert.isNull(queryStepExecuteProgressDetailReqDto.getObjectId(),"B3获取执行进度情况(公共)-D3查步骤执行进度情况-归属对象内容ID不能为空",false);
Assert.isNull(queryStepExecuteProgressDetailReqDto.getUseTypeCode(),"B3获取执行进度情况(公共)-D3查步骤执行进度情况-用途类型编码不能为空",false);
Assert.isNull(queryStepExecuteProgressDetailReqDto.getThemeContentId(),"B3获取执行进度情况(公共)-D3查步骤执行进度情况-主题内容ID不能为空",false);
Assert.isNull(queryStepExecuteProgressDetailReqDto.getConfItemCode(),"B3获取执行进度情况(公共)-D3查步骤执行进度情况-配置项标识不能为空",false);
Assert.isNull(queryStepExecuteProgressDetailReqDto.getCustomField(),"B3获取执行进度情况(公共)-D3查步骤执行进度情况-是否精准进度查询背景图不能为空",false);
      queryStepExecuteProgressDetailRespDto = fwAppExecuteProgressClient.queryStepExecuteProgressDetail(queryStepExecuteProgressDetailReqDto).getData()/*vcase invoke 跨dubbo调用;*/;
      
      
      queryStepExecuteProgressDetailRespDto_1 = queryStepExecuteProgressDetailRespDto;

BffObtainExecuteProgressComBorderRespDto retData = new BffObtainExecuteProgressComBorderRespDto();
  if(queryStepExecuteProgressDetailRespDto_1!=null){
      retData.setExecuteProgressValue(queryStepExecuteProgressDetailRespDto_1.getExecuteProgressValue());//SimpleFieldAssign//sourceId:1080359_1
retData.setExtensionField3(queryStepExecuteProgressDetailRespDto_1.getExtensionField3());//SimpleFieldAssign//sourceId:1066416_1
      // TODO: 2024/1/18  
retData.setBackGroundAddress(CommonFunctionHelper.getFilePath(queryStepExecuteProgressDetailRespDto_1.getBackGroundAddress()));//SimpleFieldAssign//sourceId:1490372_1
    }


  
  
return retData;
  }
/**
   * B3重置执行进度处理(公共)[7211]
   * gen by moon at 6/28/2023, 7:03:31 PM
   */
    @Trace(operationName = "B3重置执行进度处理(公共)")
    @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Override
  public BffResetExecuteProgressDisposeComRespDto resetExecuteProgressDisposeCom(BffResetExecuteProgressDisposeComReqDto reqDto){


       //步骤0: D3-重置执行进度处理(公共) - resetExecuteProgressDisposeCom
     ResetExecuteProgressDisposeComRespDto resetExecuteProgressDisposeComRespDto = null;
    ResetExecuteProgressDisposeComReqDto resetExecuteProgressDisposeComReqDto=new ResetExecuteProgressDisposeComReqDto();
  if(reqDto!=null){
      resetExecuteProgressDisposeComReqDto.setObjectId(reqDto.getObjectId());//SimpleFieldAssign//sourceId:1037654_1
resetExecuteProgressDisposeComReqDto.setUseTypeCode(reqDto.getUseTypeCode());//SimpleFieldAssign//sourceId:1037655_1
resetExecuteProgressDisposeComReqDto.setThemeContentId(reqDto.getThemeContentId());//SimpleFieldAssign//sourceId:1037656_1
    }

    /*D3-重置执行进度处理(公共)[7210]   */
    Assert.isNull(resetExecuteProgressDisposeComReqDto.getObjectId(),"B3重置执行进度处理(公共)-D3-重置执行进度处理(公共)-归属对象内容ID不能为空",false);
Assert.isNull(resetExecuteProgressDisposeComReqDto.getUseTypeCode(),"B3重置执行进度处理(公共)-D3-重置执行进度处理(公共)-用途类型编码不能为空",false);
Assert.isNull(resetExecuteProgressDisposeComReqDto.getThemeContentId(),"B3重置执行进度处理(公共)-D3-重置执行进度处理(公共)-主题内容ID不能为空",false);
      resetExecuteProgressDisposeComRespDto = fwAppExecuteProgressClient.resetExecuteProgressDisposeCom(resetExecuteProgressDisposeComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;




BffResetExecuteProgressDisposeComRespDto retData = new BffResetExecuteProgressDisposeComRespDto();





return retData;
  }
  //
}
